#!/bin/bash

test_arr=(1 2 3 4 5 6);

echo ${test_arr[0]};
echo ${test_arr[1]};
echo ${test_arr[2]};

index3=3;
echo ${test_arr[${index3}]};
index4=4;
echo ${test_arr[${index4}]};
index5=5;
echo ${test_arr[${index5}]};

#以清单的形式打印出数组中所有的值
echo ${test_arr[*]};
echo ${test_arr[@]};

#打印数组长度
echo ${#test_arr[*]};
#打印数组value的长度
echo ${#test_arr[0]};